﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SaleOnlineSystem.Admin.Controls
{
    public partial class ViewOrder : System.Web.UI.UserControl
    {
        public string id = "";
        public string name;
        public string email;
        public string address;
        public string phone;
        public string totalprice;
        protected void Page_Load(object sender, EventArgs e)
        {
           
                if (Request.QueryString["idorder"] != null)
                {
                    id = Request.QueryString["idorder"];
                    //string sql = "select * from tbl_Product ,tbl_Orders, tbl_OrderLine where tbl_Orders.Orders_ID = '" + id + "' AND tbl_Product.Product_ID = tbl_OrderLine.Product_ID AND tbl_OrderLine.Orders_ID = tbl_Orders.Orders_ID";
                    string sql = "select * from tbl_Product ,tbl_Orders, tbl_OrderLine,tbl_ProductColor,tbl_Color,tbl_ProductSize,tbl_Size where tbl_Orders.Orders_ID = '" + id + "' AND tbl_Product.Product_ID = tbl_OrderLine.Product_ID AND tbl_OrderLine.Orders_ID = tbl_Orders.Orders_ID AND tbl_ProductColor.Product_ID = tbl_Product.Product_ID AND tbl_ProductSize.ProductColor_ID = tbl_ProductColor.ProductColor_ID AND tbl_ProductColor.Color_ID = tbl_Color.Color_ID AND tbl_ProductSize.Size_ID = tbl_Size.Size_ID AND tbl_OrderLine.ProductColor_ID = tbl_ProductColor.ProductColor_ID AND tbl_OrderLine.ProductSize_ID = tbl_ProductSize.ProductSize_ID";
                    System.Data.DataTable dt = DAL.DCollector.DBCollector.Instance.CallStored("callstored", sql, true);
                    name = dt.Rows[0]["Employee_FullName"].ToString();
                    email = dt.Rows[0]["Employee_Email"].ToString();
                    address = dt.Rows[0]["Employee_Address"].ToString();
                    phone = dt.Rows[0]["Employee_Phone"].ToString();
                    totalprice = dt.Rows[0]["Orders_TotalPrice"].ToString();
                    rpt_order.DataSource = dt;
                    rpt_order.DataBind();

                }
           
        }

        protected void lbtquaylai_Click(object sender, EventArgs e)
        {
            Response.Redirect("/Admin/Index.aspx?panel=3&sub=0");
        }
    }
}